package com.fh.service.system.supervisor;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fh.dao.DaoSupport;
import com.fh.entity.Page;
import com.fh.util.PageData;


@Service("supervisorService")
public class SupervisorService {

	@Resource(name = "daoSupport")
	private DaoSupport dao;
	
	/*
	* 新增
	*/
	public void save(PageData pd)throws Exception{
		dao.save("SupervisorMapper.save", pd);
	}
	
	/*
	* 保存导入数据
	*/
	public void saveh(PageData pdh)throws Exception{
		dao.save("SupervisorMapper.saveh", pdh);
	}
	/*
	* 删除
	*/
	public void delete(PageData pd)throws Exception{
		dao.delete("SupervisorMapper.delete", pd);
	}
	
	/*
	* 修改
	*/
	public void edit(PageData pd)throws Exception{
		dao.update("SupervisorMapper.edit", pd);
	}
	
	/*
	*列表
	*/
	public List<PageData> list(Page page)throws Exception{
		return (List<PageData>)dao.findForList("SupervisorMapper.datalistPage", page);
	}
	
	/*
	*列表(全部)
	*/
	public List<PageData> listAll(PageData pd)throws Exception{
		return (List<PageData>)dao.findForList("SupervisorMapper.listAll", pd);
	}
	
	/*
	* 通过id获取数据
	*/
	public PageData findById(PageData pd)throws Exception{
		return (PageData)dao.findForObject("SupervisorMapper.findById", pd);
	}
	/*
	 * 通过Username获取数据
	 */
	
	public PageData findByUsername(PageData pd)throws Exception{
		return (PageData)dao.findForObject("SupervisorMapper.findByUsername", pd);
	}
	
	//通过名字，院系和专科本科查
	public PageData findByAttr(PageData pd)throws Exception{
		return (PageData)dao.findForObject("SupervisorMapper.findByAttr", pd);
	}



	/*
	 * 通过thesis的唯一性
	 */
	
	public PageData checkedthesis(PageData pdh)throws Exception{
		return (PageData)dao.findForObject("SupervisorMapper.checkedthesis", pdh);
	}

	/*
	* 批量删除
	*/
	public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
		dao.delete("SupervisorMapper.deleteAll", ArrayDATA_IDS);
	}
	/*
	 * 保存用户IP
	 */
	public void saveIP(PageData pd)throws Exception{
		dao.update("SupervisorXMapper.saveIP", pd);
	}
	/*
	 * 保存用户登录时间
	 */
	public void updateLastLogin(PageData pd)throws Exception{
		dao.update("SupervisorXMapper.updateLastLogin", pd);
	}
	
	/*
	 * 修改
	 */
	public void editChecked(PageData pdh)throws Exception{
		dao.update("SupervisorMapper.editChecked", pdh);
	}
}

